﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BabyFood.Entities;
using BabyFood.Data;

public partial class SiteTraLoi : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            HienThiTraLoi();
        }
    }
    private void HienThiTraLoi()
    {
        int Toltalrows = 0;
        string WhereClause = "1=1";
        TList<TraLoi> Tlist_TraLoi = DataRepository.TraLoiProvider.GetPaged(WhereClause, "Id DESC", 0, 15, out Toltalrows);
        dlTraLoi.DataSource = Tlist_TraLoi;
        dlTraLoi.DataBind();
    }
    public string GetNoiDung(object id)
    {
        Guid s = new Guid(id.ToString());
        LienHe ent_LienHe = DataRepository.LienHeProvider.GetById(s);
        return ent_LienHe.TieuDe;
    }
    public string GetTieuDe(object Char)
    {
        string s = Char.ToString();
        return Common.ConvertToUnSign(s);
    }
    public string formatString(string str, int n)
    {
        string kq = "";

        if (str.Length > n)
            kq = str.Substring(0, n + 1) + "...";
        else
            kq = str;

        return kq;
    }
}